using Game.XH;
using UnityEngine;

namespace Game.Component.Character
{
	public class Head : CharacterComponent
	{
		public int headId;

		public Color32 color;

		public Head(Transform trans, int z)
			: base(trans)
		{
			trans.SetLocalZ((float)z * 1E-05f);
		}

		public void SetHead(int id, Transform copy)
		{
			if (headId != id)
			{
				headId = id;
				ChangeSprite(copy);
			}
		}

		public void SetColor(Color32 color)
		{
			this.color = color;
			ChangeSpriteColor(spriteRenderer, color);
		}

		public void SetBoxColliderEnabled(bool val)
		{
			BoxCollider2D component = transform.GetComponent<BoxCollider2D>();
			if (component != null)
			{
				component.enabled = val;
			}
		}
	}
}
